home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / installboot / RCS / installsun.c,v < prev    next >
Encoding:
Text File  |  1990-02-17  |  1.9 KB  |  90 lines

  1. head     1.1;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.1
  10. date     90.02.16.16.12.24;  author shirriff;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @Code to install sun format boot file.
  17. @
  18.  
  19.  
  20.  
  21. 1.1
  22. log
  23. @Initial revision
  24. @
  25. text
  26. @/* 
  27.  * installsun.c --
  28.  *
  29.  *    Check the header of a coff file.
  30.  *
  31.  * Copyright 1990 Regents of the University of California
  32.  * All rights reserved.
  33.  * Permission to use, copy, modify, and distribute this
  34.  * software and its documentation for any purpose and without
  35.  * fee is hereby granted, provided that the above copyright
  36.  * notice appear in all copies.  The University of California
  37.  * makes no representations about the suitability of this
  38.  * software for any purpose.  It is provided "as is" without
  39.  * express or implied warranty.
  40.  */
  41.  
  42. #ifndef lint
  43. static char rcsid[] = "$Header: /sprite/src/admin/installboot/RCS/installboot.c,v 1.4 89/08/15 12:28:44 rab Exp Locker: brent $ SPRITE (Berkeley)";
  44. #endif
  45.  
  46. #include <sprite.h>
  47. #include <kernel/sun3.md/procMach.h>
  48. #include <stdio.h>
  49.  
  50.  
  51. /*
  52.  *----------------------------------------------------------------------
  53.  *
  54.  * SunHeader -
  55.  *
  56.  *    See if the boot program has a sun header.
  57.  *
  58.  * Results:
  59.  *    An error code.
  60.  *
  61.  * Side effects:
  62.  *    None.
  63.  *
  64.  *----------------------------------------------------------------------
  65.  */
  66. ReturnStatus
  67. SunHeader(bootFID, loadAddr, execAddr, length)
  68.     int bootFID;    /* Handle on the boot program */
  69.     Address *loadAddr;    /* Address to start loading boot program. */
  70.     Address *execAddr;    /* Address to start executing boot program. */
  71.     int *length;    /* Length of boot program. */
  72. {
  73.     ProcExecHeader aout;
  74.     int bytesRead;
  75.  
  76.     if (lseek(bootFID,0,0)<0) {
  77.     perror("");
  78.     return FAILURE;
  79.     }
  80.     bytesRead = read(bootFID, (char *)&aout, sizeof(ProcExecHeader));
  81.     if (bytesRead < 0 || aout.magic != PROC_OMAGIC) {
  82.     return FAILURE;
  83.     }
  84.     *loadAddr = 0;
  85.     *execAddr = 0;
  86.     *length = aout.code + aout.data;
  87.     return SUCCESS;
  88. }
  89. @
  90.